package apiday02homework;

public class ReplaceAllDemo {
    public static void main(String[] args) {
        /*
        String str = "asdfsadfas1231231sadfsdfsa";
        String str1 = "123123123avabab";
        str = str.replaceAll("[0-9]+", "num ");
        System.out.println(str);
        str1 = str1.replace("123","_");
        System.out.println(str1);


        String regex = "(gun|sb|nmsl)";
        String message = "gun nmsl sb hhh";
        System.out.println(message.replaceAll(regex,"*"));

         */
        String str = "abc1234abc";
        str = str.replaceAll("[a-z]+", "words");
        System.out.println(str);

        String line = "(nmsl|sb|qnmlgb)";
        String message = "wsnd sb qnmlgb";
        message = message.replaceAll(line, "*");
        System.out.println(message);
    }
}
